package top.sjydzq.www.controller.Management;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import top.sjydzq.www.service.OrderService;

@Controller
@RequestMapping("/management/order/")
public class MOrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("list")
    public String list(Model model) {
        model.addAttribute("orders", orderService.selectAll());

        return "Management/Order/list";
    }

    @RequestMapping("remove")
    public String handleRemove(int id) {
        orderService.remove(id);

        return "redirect:/management/order/list";
    }
}
